import pandas as pd
import re

from utils.question_format import format_question_answer

COUNT = 10


class AiCorrecte:
    def __init__(self, file_name):
        """
        初始化方法

        参数:
            file_name (str): Excel文件路径
        """
        self.df = pd.read_excel(file_name)
        self.selected_questions = self.df.head(COUNT)

    def display_questions(self):
        """
        生成格式化的问题列表

        返回:
            list: 包含格式化后问题字符串的列表
        """
        queries = []
        for index, row in self.selected_questions.iterrows():
            if pd.isnull(row["question"]):
                continue  # 跳过当前循环

            query = format_question_answer(row)
            queries.append(query)  # 将问题添加到列表中
        return queries
